package com.ocl.www.controller;


import com.ocl.www.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2017/6/1.
 */
@Controller
public class DemoController {

        @Autowired
        DemoService demoService;

        @RequestMapping("/test")
        @ResponseBody
        public String putCache(){
            demoService.findNo();
            System.out.println("若下面没出现“无缓存的时候调用”字样且能打印出数据表示测试成功");
            return "ok";
        }


        @RequestMapping("/test2")
        @ResponseBody
        public String testCache(HttpServletRequest request){
            System.out.println(request.getSession().getId());
            String str = demoService.findNo();
            System.out.println("我这里没执行查询");
            System.out.println("str:"+"/"+str);
            return "ok";
        }
}

